<?php
function formatDate($date) {
    $d = new DateTime(sprintf('%04.d-%02.2d-%02.2d', $date->year, $date->month,
        $date->day));
    return $d->format('l M j, Y');
}